export const schema = {
    type: "page",
    title: "申请加入的志愿者",
    body: {
        type: "crud",
        api: "/api/volunteer/applylist",
        columnsTogglable: false,
        filter: {
            title: "",
            panelClassName: 'm-b-none bg-gd no-border',
            bodyClassName: 'wrapper-sm',
            submitText: "",
            mode: "inline",
            controls: [
                {
                    type: "button-group",
                    btnActiveClassName: "btn-info active",
                    value: "0",
                    submitOnChange: true,
                    name: "status",
                    options: [
                        {
                            label: "全部",
                            value: ""
                        },
                        {
                            label: "待审核",
                            value: "0"
                        },
                        {
                            label: "通过",
                            value: "1"
                        },
                        {
                            label: "不通过",
                            value: "2"
                        }
                    ]
                },

                {
                    type: "text",
                    name: "keyword",
                    placeholder: "用户名、联系电话、证件号码",
                    width: 260,
                    addOn: {
                        type: "submit",
                        label: "搜索",
                        primary: true
                    }
                }
            ]
        },
        bulkActions: [
            {
                type: "button",
                label: "同意加入",
                actionType: "ajax",
                level: "success",
                api: "post:/api/volunteer/accept/${ids}"
            },

            {
                type: "button",
                label: "拒绝申请",
                level: "danger",
                actionType: "dialog",
                dialog: {
                    title: "拒绝申请",
                    body: {
                        type: "form",
                        api: "post:/api/volunteer/reject/${ids}",
                        controls: [
                            {
                                type: "text",
                                label: "理由",
                                name: "reason"
                            }
                        ]
                    }
                }
            }
        ],
        columns: [
            {
                name: "volunteer_id",
                label: "志愿者ID",
                width: 50
            },
            {
                label: "姓名",
                name: "real_name"
            },
            {
                label: "用户名",
                name: 'username'
            },
            {
                label: "性别",
                name: "sex",
                type: "map",
                map: {
                    "1": "男",
                    "2": "女"
                }
            },
            {
                label: "年龄",
                name: "age"
            },
            {
                label: "联系电话",
                name: "phone"
            },
            {
                label: "居住区域",
                innerClassName: "w",
                type: "tpl",
                tpl: "${province_name} ${city_name} ${county_name} ${addr}"
            },
            {
                label: "参与项目数",
                name: 'project_count'
            },
            {
                label: "志愿时长",
                name: "reward_time"
            },
            {
                label: "申请时间",
                name: "created_at",
                type: "tpl",
                tpl: "${created_at|date:LL:YYYY-MM-DD HH:mm:ss}"
            },
            {
                label: "状态",
                name: "verify_status",
                type: "map",
                map: {
                    "-1": "<span class='label label-default'>编辑中</span>",
                    "0": "<span class='label label-warning'>待审核</span>",
                    "1": "<span class='label label-success'>已通过</span>",
                    "2": "<span class='label label-default'>已拒绝</span> ${verify_msg}",
                    "*": "${verify_status}"
                }
            }
        ]
    }
};
